var app = angular.module('app');
app.directive('timerPicker', ['$rootScope', function ($rootScope) {
    function showTimer(element) {
        element.clockpicker({
            autoclose: true
        });
    }

    return {
        restrict: 'EA',
        replace: false,
        scope: {
            bindId: '@'
        },
        link: function (scope, element, attrs) {
            if (scope.bindId) {
                var ids = scope.bindId.split(',');
                for (var key in ids) {
                    var id = '#' + ids[key].trim();
                    $(id).click(function (e) {
                        e.stopPropagation();
                        showTimer(element);
            });
        }
            }

            showTimer(element);
        }
    };
}]);